"""author: zsw
   data: 2021/11/22
   project: aaaaaaa我爱学习
"""

# import requests
# url = 'http://www.pp3.cn/uploads/20120418lw/13.jpg'
# # #发送请求
# response = requests.get(url)
# # 保存到本地
# with open("a.jpg", "wb") as f:
#     f.write(response.content)


# import random
# f=open('ips.txt','w+')
# for i in range(120000):
#     f.write('172.25.254.'+str(random.randint(1,256))+'\n')
# f.seek(0)   #指向最开始的位置
# s={}    #定义一个空字典
# for i in f.readlines():
#     if i in s:
#         s[i]=s[i]+1
#     else:
#         s[i]=1
# sort_list=s.items()
# sort=sorted(sort_list,key=lambda x:x[1],reverse=True)[:10]
# print('出现频率前十的ip为：')
# for i in sort:
#     print(i[0])
# f.close



import string
words_dict={}
with open('test.txt',mode='r',encoding="utf-8") as f:
    alltext=f.read()
    words=alltext.split()
    for i in words:
        i=i.lower()
        if i in words_dict:
            words_dict[i]=words_dict[i]+1
        else:
            words_dict[i]=1
words_list=words_dict.items()
sort_times=sorted(words_list,key=lambda x:x[1],reverse=True)[:10]
for i in sort_times:
    print(i[0],':',i[1])